package Controlor;

import Presentation.PTasDeCartes;
import solitaire.application.Carte;
import solitaire.application.TasDeCartes;

public class CTasDeCartes  extends TasDeCartes{

	
	private PTasDeCartes presentation;
	
	public PTasDeCartes getPresentation() {
		return presentation;
	}

	public CTasDeCartes(String nom, CUsine cu) {
		super(nom, cu);
		presentation = new PTasDeCartes(this,cu);
	}
	
	public void depiler() throws Exception{
		
		CCarte c = (CCarte)getSommet();
		super.depiler();
		presentation.depiler(c.getPresentation());
	}
	
	public void empiler(Carte c){
		if(isEmpilable(c)){
			super.empiler(c);
			try {
				if(c == getSommet()){
					presentation.empiler(((CCarte)getSommet()).getPresentation());
				}
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
		
	}

}
